// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.core.network;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;

public final class ByteBufferReader {
    public ByteBuffer bb;

    public ByteBufferReader(ByteBuffer _bb) {
        this.bb = _bb;
    }

    public boolean getBoolean() {
        return this.bb.get() != 0;
    }

    public byte getByte() {
        return this.bb.get();
    }

    public char getChar() {
        return this.bb.getChar();
    }

    public double getDouble() {
        return this.bb.getDouble();
    }

    public float getFloat() {
        return this.bb.getFloat();
    }

    public int getInt() {
        return this.bb.getInt();
    }

    public long getLong() {
        return this.bb.getLong();
    }

    public short getShort() {
        return this.bb.getShort();
    }

    public String getUTF() {
        short _short = this.bb.getShort();
        byte[] _byte = new byte[_short];
        this.bb.get(_byte);

        try {
            return new String(_byte, "UTF-8");
        } catch (UnsupportedEncodingException unsupportedEncodingException) {
            throw new RuntimeException("Bad encoding!");
        }
    }
}
